package com.gxa.common.util;


import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @author zxd
 * @date 2025/6/14
 */
public class ResponseUtils {

    public static void responseJson(HttpServletResponse response, Object obj) throws IOException {
        ObjectMapper objectMapper = new ObjectMapper();
        String json = objectMapper.writeValueAsString(obj);
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().write(json);
    }

}